module EasyForm
  module Components
    module Placeholders
      def placeholder(wrapper_options = nil)
        input_html_options[:placeholder] ||= placeholder_text
        nil
      end

      private
      def placeholder_text
        placeholder = options[:placeholder]
        return placeholder if placeholder.is_a?(String)

        translate_from_namespace(:placeholder)
      end
    end
  end
end